import 'package:flutter/material.dart';
import 'package:flutter_douban/config/app_colors.dart';
import 'package:flutter_douban/model/note_model.dart';

class NoteDetailFooter extends StatelessWidget {
  final NoteModel model;

  const NoteDetailFooter({Key? key, required this.model}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      color: Colors.white,
      height: kToolbarHeight,
      width: MediaQuery.of(context).size.width,
      padding: EdgeInsets.only(left: 20, right: 10),
      child: Row(
        mainAxisAlignment: MainAxisAlignment.spaceBetween,
        children: [_rightWidget(), _leftWidget()],
      ),
    );
  }

  Widget _rightWidget() {
    return Container(
      alignment: Alignment.centerLeft,
      width: 150,
      height: 40,
      decoration: BoxDecoration(
        color: AppColors.line,
        borderRadius: BorderRadius.circular(20),
      ),
      child: Text(
        '     ' + model.comment_hint! + '...',
        style: TextStyle(fontSize: 14, color: AppColors.black),
      ),
    );
  }

  Widget _leftWidget() {
    return Row(
      children: [
        _itemWidget('icon_home_comment', model.comments_count_text!),
        _itemWidget('bottomtool_unlike', model.like_count_text!),
        _itemWidget('icon_home_collection', '收藏'),
      ],
    );
  }

  Widget _itemWidget(String icon, String name) {
    return Container(
      padding: EdgeInsets.only(left: 4, right: 4),
      child: Row(
        children: [
          Image.asset(
            'assets/images/common/${icon}.png',
            width: 20,
            height: 20,
          ),
          SizedBox(
            width: 5,
          ),
          Text(
            name,
            style: TextStyle(fontSize: 13, color: Colors.black),
          )
        ],
      ),
    );
  }
}
